﻿
@{
    ViewBag.Title = "批量检查品牌";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}

<form id="S_Form" action="@Url.Action("BatchCheck", "brand")" me method="post" class="definewidth m20" enctype="multipart/form-data">
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td colspan="4" style="width:50%">
                <h5>批量检查品牌是否存在,<span class="red">多个品牌名称检查按回车键换行输入</span></h5>
            </td>
        </tr>
        <tr>
            <td width="6%" class="tableleft">品牌名称<em>*</em></td>
            <td>
                <textarea name="brand_names" style="width:88%; height:300px;" cols="4"></textarea>
            </td>
            <td width="6%" class="tableleft">检查结果</td>
            <td>
                <textarea id="txtresult" name="txtresult" style="width:88%;height:300px;" cols="4"></textarea>
            </td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td colspan="3">
                <p><span id="spMsg"></span></p>
                <button type="submit" class="btn btn-primary">检查</button> &nbsp;&nbsp;
                <button type="button" class="btn btn-success" name="btnclear" id="btnclear">清空结果</button>
            </td>
        </tr>
    </table>
    <script>
        $('#btnclear').on('click', function () {
            $("#txtresult").val("");
        });

        BUI.use('bui/overlay', function (overlay) {
            $(function () {
                var validator = $('form').validate({
                    errorLabelContainer: $("#errorContainer"),
                    errorElement: "span",
                    rules: {
                        brand_names: { required: true }
                    },
                    messages: {
                        brand_names: { required: "请输入品牌名称" }
                    },
                    submitHandler: function (form) {
                        $(form).ajaxSubmit(function (result) {
                            if (result.Message != undefined) {
                                if (result.IsSuccess) {
                                    $("#txtresult").val(result.Body);
                                }
                                else {
                                    showFail(result.Message, "");
                                }
                            }
                            else {
                                ShowActionError(result);
                            }
                        });
                    }
                });

            });
        });
    </script>
</form>
